﻿using AutoMapper;
using Org.BouncyCastle.Crypto.Modes;
using PHMEE.Entities.DaqInfo.TdDevices;
using PHMEE.Entities.MqttDt.CollectPara;
using Volo.Abp.Guids;

namespace PHMEE.Admin
{
    public class PHMEEAdminApplicationAutoMapperProfile : Profile
    {
        public PHMEEAdminApplicationAutoMapperProfile()
        {
            CreateMap<Company, CompanyDto>();

            CreateMap<Fleet, FleetDto>();

            CreateMap<Vessel, VesselDto>();

            CreateMap<Unit, UnitDto>();

            CreateMap<Equipment, EquipmentDto>();

            CreateMap<Component, ComponentDto>();

            CreateMap<Point, PointDto>();

            #region DaqInfo
            //CreateMap<Threshold, Threshold>();
            CreateMap<Threshold, ThresholdDto>();
            CreateMap<CreateThresholdDto, Threshold>();
            CreateMap<Category, CategoryLookupDto>();

            CreateMap<WaveInterval, WaveIntervalDto>();
            CreateMap<CreateWaveIntervalDto, WaveInterval>();
            CreateMap<UpdateWaveIntervalDto, WaveInterval>();

            CreateMap<CreateDatabaseDto, TdDatabase>();
            CreateMap<CreateSuperTableDto, TdDeviceType>();
            CreateMap<CreateAndUpdateAttributesDto, TdDeviceAttribute>();
            CreateMap<CreateSubTableDto, TdDeviceInstance>();
            CreateMap<TdDevicePointRelation, PointRelationDto>();
            #endregion

            #region MqttDt
            CreateMap<SysParaCreateDto, SysPara>();
            CreateMap<SysPara, SysParaListDto>();
            CreateMap<SysPara, SysParaByIdDto>();
            CreateMap<SysPara, SysParaDto>();
            CreateMap<SysParaUpdateDto, SysPara>();

            CreateMap<Sensor, SensorResultDto>();

            CreateMap<CreateSysParaExtendDto, SysParaExtend>()
                .ForMember(dest => dest.Version, opt => opt.MapFrom(src => src.Ver));
            CreateMap<SysParaExtend, SysParaExtendDto>();

            //CreateMap<CollectParaCreateDto, CollectParameter>();
            //CreateMap<CollectParaUpdateDto, CollectParameter>();

            CreateMap<VibChannelParaCreateDto, VibChannelPara>()
                .ForMember(dest => dest.Id, opt => opt.Ignore());
            CreateMap<VibChannelParaUpdateDto, VibChannelPara>();

            CreateMap<VibParaCreateDto, VibPara>()
                .ForMember(dest => dest.Id, opt => opt.Ignore());
            CreateMap<VibParaUpdateDto, VibPara>();

            //CreateMap<LimitParaCreateDto, LimitPara>()
            //    .ForMember(dest => dest.Id, opt => opt.Ignore()); ;
            //CreateMap<LimitParaUpdateDto, LimitPara>();

            //// 反向映射
            //CreateMap<CollectParameter, CollectParaCreateDto>();
            //CreateMap<CollectParameter, CollectParaFormDto>();
            //CreateMap<CollectParameter, CollectParaDto>();
            //CreateMap<CollectParameter, CollectParaUpdateDto>();

            CreateMap<VibChannelPara, VibChannelParaCreateDto>();
            CreateMap<VibChannelPara, VibChannelParaFormDto>();
            CreateMap<VibChannelPara, VibChannelParaDto>();
            CreateMap<VibChannelPara, VibChannelParaFirstDto>();
            CreateMap<VibChannelPara, VibChannelParaUpdateDto>();

            CreateMap<VibPara, VibParaCreateDto>();
            CreateMap<VibPara, VibParaFormDto>();
            CreateMap<VibPara, VibParaDto>();
            CreateMap<VibPara, VibParaUpdateDto>();

            //CreateMap<LimitPara, LimitParaCreateDto>();
            //CreateMap<LimitPara, LimitParaFormDto>();
            //CreateMap<LimitPara, LimitParaDto>();
            //CreateMap<LimitPara, LimitParaUpdateDto>();

            #endregion

            CreateMap<MainenanceAdvice, MainenanceAdviceDto>();

            CreateMap<BearFactory, BearFactoryDto>();

            CreateMap<BearLib, BearLibDto>();

            CreateMap<BearLibImportDto, BearLib>();

        }

    }
}
